package com.qqtech.qquan.sales.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.qqtech.core.frame.dao.BaseDaoImpl;
import com.qqtech.qquan.sales.model.SalesBase;
import com.qqtech.qquan.sales.model.SalesBaseVo;

@Repository
public class SalesBaseDaoImpl extends BaseDaoImpl<SalesBase> implements SalesBaseDao {
	public static final Logger log = LoggerFactory.getLogger(SalesBaseDaoImpl.class);

	@Override
	public SalesBaseVo getByShopId(Integer shopId) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("shopId", shopId);
		List<SalesBaseVo> list = sqlSessionTemplate.selectList(getSqlName("getByShopId"), map);
		if(list != null && list.size() > 0){
			SalesBaseVo vo = list.get(0);
			return vo;
		}
		return null;
	}

	@Override
	public SalesBaseVo getByTarget(Integer target, Integer shopId) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("shopId", shopId);
		map.put("target", target);
		List<SalesBaseVo> list = sqlSessionTemplate.selectList(getSqlName("getByTarget"), map);
		if(list != null && list.size() > 0){
			SalesBaseVo vo = list.get(0);
			return vo;
		}
		return null;
	}
	
}
